-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block JSON schema: Update shadow
definition
#58910
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
shadow
definitionshadow
definition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning this up @t-hamano 👍
Tested this by tweaking the button block.json file. The behaviour matches that shown in this PR's demo.
I think the reason object is allowed is because it assumes the __experimentalSkipSerialization property
Without allowing an object here, there is no means by which to opt into shadow block support but skip serialization. So both the object
and boolean
options are necessary.
Ideally, we might need to update the unit test logic to exclude properties with the __experimental prefix before validating the schema
This sounds like a good follow-up to me 🙂
@aaronrobertshaw Thanks for the review! |
Follow up #58306
What?
This PR updates the definition of the shadow property in the block.json schema.
Why?
Current schema allows boolean or object. I think the reason object is allowed is because it assumes the
__experimentalSkipSerialization
property. However, this property is not exposed on block.json schema. Furthermore, it is not possible to read from the schema whether the default value ofshadow
is true or false.How?
I changed the type back to boolean only and defined the default value as false.I initially simply changed the type to a
boolean
value as below, but this seems to cause unit tests to fail.This is because the actual block.json also defines an object with the
__experimentalSkipSerialization
property, even though the schema expects onlyboolean
type.Therefore, in this PR, I limited ourselves to adding the default value (
false
) and description. Ideally, we might need to update the unit test logic to exclude properties with the__experimental
prefix before validating the schema.Testing Instructions
Verify that the code editor displays the correct definition using the file below.
Screenshots or screencast
63be096f0d8789702923819396dc8493.mp4